package leader.action;
import java.util.List;

import admin.bean.Subject;

import com.opensymphony.xwork2.ActionContext;

import leader.bean.Leader;
import leader.bean.MidTable;
import leader.service.DirectTeacherService;
import leader.service.LeaderService;
import leader.service.MidteaexpService;
import teacher.bean.Expertclass;
import teacher.bean.Midteaexp;
import teacher.bean.Teacher;
import tools.StringDate;

public class ToTeacherMangerAction {
	private List<Expertclass> experter;
	private Teacher teach;
	private Teacher teacher;
	private Leader leader;
	private Subject subject;
	private List<MidTable> midtable;
	private String birth;
	public String getBirth() {
		return birth;
	}
	public void setBirth(String birth) {
		this.birth = birth;
	}
	public List<Expertclass> getExperter() {
		return experter;
	}
	public void setExperter(List<Expertclass> experter) {
		this.experter = experter;
	}
	public Teacher getTeach() {
		return teach;
	}
	public void setTeach(Teacher teach) {
		this.teach = teach;
	}
	
	public Teacher getTeacher() {
		return teacher;
	}
	public void setTeacher(Teacher teacher) {
		this.teacher = teacher;
	}
	public Leader getLeader() {
		return leader;
	}
	public void setLeader(Leader leader) {
		this.leader = leader;
	}
	
	public Subject getSubject() {
		return subject;
	}
	public void setSubject(Subject subject) {
		this.subject = subject;
	}
	
	public List<MidTable> getMidtable() {
		return midtable;
	}
	public void setMidtable(List<MidTable> midtable) {
		this.midtable = midtable;
	}
	public String execute() {
		System.out.println("============");
		LeaderService LS = new LeaderService();
		experter = LS.selectAllExpertclass();
		LeaderService leaderS = new LeaderService();
		DirectTeacherService selectteacher = new DirectTeacherService();
		Teacher tea = new Teacher();
		tea = selectteacher.selectTeacherById(teach);
		teacher = tea;
		leader = leaderS.selectLeader(tea);
		subject = leaderS.selectSubject(tea);
		experter = LS.selectAllExpertclass();
		StringDate date = new StringDate();
		birth = date.DateToString(teacher.getBirthday());
		MidteaexpService mid = new MidteaexpService();
		if(mid.getAllExpById(tea).size() > 0) {
			midtable = mid.getAllExpById(tea);
			System.out.println("************************8"+midtable.get(0).getMedate());
		}
		return "success";
		
	}
}
